/**
	Copyright (c) 2010 ATTi 
	All rights reserved.
	Author: Michael Shu
	Date: 9/15/2010
	Depreciated since s142 on 6/17/2011
*/

public class CaseOwnerChangeValidationHelper {
	/*
	public static String System_Administrator = 'System Administrator';
	public static Set<String> ExceptionRoleList = new Set<String>{'SFDC Admin','Information Systems','Customer Care Executive'};
	
	public static String IOG_Search_Change_Facilitator = 'IOG Search Change Facilitator';
	
	public static Set<String> Allowed_Queues_CCIR = new Set<String>{'IOG Pay-Per-Call Support'
		                                                     ,'IOG Production Support'
		                                                     ,'IOG Search Support'
		                                                     ,'IOG Tech Support'
		                                                     ,'IOG Tier 1 Customer Support'
		                                                     ,'IOG Tier 2 Change Facilitator'
		                                                     ,'IOG Tier 2 Escalation Team'
		                                                     ,'IOG Video Support'
		                                                     ,'Product SME - IR'
		                                                     ,IOG_Search_Change_Facilitator
		                                                     ,'IOG West Video Support'
		                                                     ,'IOG West SES Support'
		                                                     ,'IOG Fulfillment Support'
		                                                     ,'IOG ATT411 Support'
		                                                     ,'IYP Preview Team'
		                                                     };
		                                                      
	public static Set<String> Allowed_Queues_CCOOR = new Set<String>{'Collections Support Queue'
		                                                     ,'Credit Support Queue'
		                                                     ,'Graphic Support Queue'
		                                                     ,'Phone Support Queue'
		                                                     ,'Post-Fulfillment Support Queue'
		                                                     ,'Sales Support Queue'
		                                                     ,'Tier1 Support Queue'
		                                                     ,'Tier2 Support Queue'
		                                                     ,'Website Consultant Queue'
		                                                     ,'Tier 1 Resolution Queue'
		                                                     ,'OOR Bronze Support Queue'
		                                                     ,'OOR Gold Support Queue'
		                                                     ,'Tier 1 Escalation'
		                                                     };
		                                                     
     public static Map<String, Set<String>> Profile_Allowed_Queues = new Map<String, Set<String>>{
                                                    'Customer Care' =>  Allowed_Queues_CCOOR
                                                   ,'Customer Care Management' => Allowed_Queues_CCOOR
                                                   ,'Customer Care - IR' => Allowed_Queues_CCIR
                                                   ,'Customer Care Reporting - IR' => Allowed_Queues_CCIR
                                                   ,'Customer Care - IR - Knowledge Contributors' => Allowed_Queues_CCIR
                                                   }; 
     
     public static Set<String> Tier2SMERoleNames = new Set<String>{'Tier 2 Manager - IR','Tier 2 Supervisor - IR','Tier 2 CSR - IR'
     	                                                          ,'Product SME - Manager - IR','Product SME - IR','Customer Care Director - IR'};
     
     public static String ERROR_CHOOSE_WRONG_QUEUES = ' You are not allowed to choose this Queue as case owner, please try again!'; 
     
     public static Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe(); 
     public static String Queue_Prefix =  gd.get('Group').getDescribe().getKeyPrefix();
     public static User curUser;
     public static Map<ID, Group> allowedQIds;
     public static ID incidentTypeId, changeTaskTypeId, inquiryTypeId, contenttaskTypeId;
     
     public static void validateNewOwnerChange(List<Case> caseOwnerChangedToQueue){
     	if(caseOwnerChangedToQueue != null && !caseOwnerChangedToQueue.isEmpty()){
     		if(curUser == null){
     			curUser = [select Profile.Name, UserRole.Name from User where Id =: UserInfo.getUserId()]; 
     		}
     		if(!curUser.Profile.Name.startsWith(System_Administrator) && !ExceptionRoleList.contains(curUser.UserRole.Name)){
				if(Profile_Allowed_Queues.containsKey(curUser.Profile.Name)){
					Set<String> allowedQname = Profile_Allowed_Queues.get(curUser.Profile.Name);
					if(allowedQIds == null){
						allowedQIds = new Map<ID, Group>([select ID, Name from Group where Type =: 'Queue' and Name IN: allowedQname]);
					}
					for(Case c : caseOwnerChangedToQueue){
						if(!allowedQIds.containsKey(c.OwnerId)){ // general validation rule
							c.OwnerId.addError(ERROR_CHOOSE_WRONG_QUEUES);
						}else{                                   // special validation rule
							validateIOGSearchChangeFacilitatorsQueue(c);
						}
					}
				}
     		}
		}
     }
     
     public static void validateIOGSearchChangeFacilitatorsQueue(Case c){
     	String queueOwnerName = allowedQIds.get(c.OwnerId).Name;
     	if(queueOwnerName == IOG_Search_Change_Facilitator){
     		if(incidentTypeId == null )  incidentTypeId = RecordTypeHelper.GetRecordTypeId('Case', 'IOG Incident');
			if(changeTaskTypeId == null) changeTaskTypeId = RecordTypeHelper.GetRecordTypeId('Case', 'IOG Change Task');
			if(inquiryTypeId == null) inquiryTypeId = RecordTypeHelper.GetRecordTypeId('Case', 'IOG Inquiry');	
			if(contenttaskTypeId == null) contenttaskTypeId = RecordTypeHelper.GetRecordTypeID('Case', 'IOG Content Task');	
			Set<ID> allowedRecordTypes = new Set<ID>{incidentTypeId, changeTaskTypeId, inquiryTypeId, contenttaskTypeId};		
     		if(!Tier2SMERoleNames.contains(curUser.UserRole.Name) || !allowedRecordTypes.contains(c.RecordTypeId) || (c.RecordTypeId == changeTaskTypeId && c.RPI__c == null)){
     			c.OwnerId.addError(ERROR_CHOOSE_WRONG_QUEUES);
     		}
     	}
     }   
     */ 
}